package com.blockmeta.bbs.businesslibrary.util.navigation.impl;

import android.net.Uri;

import com.blockmeta.bbs.businesslibrary.arouter.RouterPath;
import com.blockmeta.bbs.businesslibrary.constant.Constant;
import com.blockmeta.bbs.businesslibrary.constant.NetConstant;
import com.blockmeta.bbs.businesslibrary.util.navigation.SimpleDeepLinkStrategy;

import java.util.HashMap;
import java.util.Map;

/**
 * @author AirThor
 * @date 2019/7/25.
 * "blockmeta://bbs/doc"
 */

public class ChainThingStrategy extends SimpleDeepLinkStrategy {
    @Override
    public Uri uriTransformer(Uri uri) {
        return Uri.parse("blockmeta://activity"+ RouterPath.CHAINTHING_ACTIVITY);
    }

    @Override
    public Map<String, String> navigationParams(Uri uri) {
        HashMap<String,String> params = new HashMap<>(2);
        String id = uri.getQueryParameter("id");
        if(id != null){
            params.put(Constant.ZERO, NetConstant.CHAIN_THING_URL + "/item/" + id);
        }
        else {
            params.put(Constant.ZERO, NetConstant.CHAIN_THING_URL);
        }
        return params;
    }
}
